<?php

class Core_Frontend_Module_Article_Comment extends Dcmp_Module_Base {

    protected $name = 'article_comment';
    
    public function install() {

    }

    public function uninstall() {

    }

    public function buildConfig($form) {
//        $form->addTextBoxField($this->__('article.label.article_id'), 'article_id', 'module[parameters][dynamic][article_id]',TRUE);
//        $form->createTab('module_option', $this->__('design.label.dynamic_parameter'),
//                array('field_article_id'));
    }

    public function render() {
        $content = $this->getVariables()->getData('article_object');
        if(!$content){
            return '';
        }

        $comments = App::getModel('article/collection_comment')
                    ->filterBy('articleid',$content->getId())
                    ->sortBy('time','desc')
                    ->filterBy('status','published')
                    ->limit(5,0)->load();
        $tmpl = $this->getTemplate()->assignMulti(array('comments' => $comments));
        return $tmpl->render($this->getTemplatePath($this->getValueByKey('template_name'),$this->getValueByKey('template_script')));
    }

}